package com.yidu.best.basicSetup.exchange.controller;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.best.basicSetup.exchange.domain.Exchange;
import com.yidu.best.basicSetup.exchange.domain.ExchangeVo;
import com.yidu.best.basicSetup.exchange.service.ExchangeService;
/**
 * 
 * @author AA
 *
 */
@Controller
@RequestMapping("/basicSetup/")
public class ExchangeController {
	@Autowired
	public ExchangeService exchangeService;
	
	/**
	 * 跳转页面到exchangeList
	 * @return
	 */
	@RequestMapping(value = "exchangeList",method = RequestMethod.GET)
	public String jumpExchange() {
		return "sys/Exchange/ExchangeList";
	}
	
	
	/**
	 * 分页查询
	 * @param exchangeVo
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "exchange",method = RequestMethod.GET)
	public  Map<String,Object> doExchange(ExchangeVo exchangeVo){
		 Map<String,Object> map = exchangeService.findExchange(exchangeVo);
		return map ;
	}
	/**
	 * 添加方法
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "exchange",method = RequestMethod.POST)
	public boolean addExchange(Exchange exchange) {
		return exchangeService.addExchange(exchange)==1?true:false;
	}
	
	/**
	 * 修改方法
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "exchange",method = RequestMethod.PUT)
	public boolean updateExchange(Exchange exchange) {
		return exchangeService.updateExchange(exchange)==1?true:false;
	}
	
	/**
	 * 删除
	 * @param area
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "exchange/{exchangeIds}", method = RequestMethod.DELETE)
	public boolean deleteExchange(@PathVariable("exchangeIds")String exchangeIds ) {
        return exchangeService.deleteExchange(exchangeIds)==1?true:false;
	}
	
	 
}
